//:协议和扩展
protocol ExampleProtocol {
    var simpleDescription: String { get }
    mutating func adjust()
}

class SimpleClass: ExampleProtocol {
    var simpleDescription: String = "A very simple class."
    var anotherProperty: Int = 69105
    func adjust() {//不需要 标记任何方法，因为类中的方法通常可以修改类属性(类的性质)
        simpleDescription += "  Now 100% adjusted."
    }
}
var a = SimpleClass()
a.adjust()
let aDescription = a.simpleDescription

struct SimpleStructure: ExampleProtocol {
    var simpleDescription: String = "A simple structure"
    mutating func adjust() { //用来标记一个会修改结构体的方法
        simpleDescription += " (adjusted)"
    }
}
var b = SimpleStructure()
b.adjust()
let bDescription = b.simpleDescription

enum SimpleEnum: ExampleProtocol{
    case first(String)
    var simpleDescription:String{
        get{
            switch self{
            case let .first(text): return text
            }
        }
    }

    mutating func adjust(){
        print("\(simpleDescription)")
    }
}
var c = SimpleEnum.first("6jk")
c.simpleDescription
c.adjust()
let cDescription = c.simpleDescription


